/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dao;


import java.util.ArrayList;
import java.sql.*;
import pojo.NhaXuatBanPOJO;

/**
 *
 * @author HP
 */
public class NhaXuatBanDAO {
 MySqlDataAccessHelper helper=new MySqlDataAccessHelper();


 /**
  *
  */
  public ArrayList<NhaXuatBanPOJO> layDSNhaXuatBan()
  {

      ArrayList<NhaXuatBanPOJO> dsnxb=new ArrayList<NhaXuatBanPOJO>();
      try{

            helper.open();
            Connection cn=(Connection) helper.getConnection();
            CallableStatement statement =(CallableStatement) cn.prepareCall("{call sp_LayDanhSachNXB()}");
           // statement.setInt(1,maTheLoai);
            statement.execute();
            ResultSet rs = statement.getResultSet();
            while(rs.next())
            {
                NhaXuatBanPOJO nxb=new NhaXuatBanPOJO();
                nxb.setMaNhaXuatBan(rs.getNString("MaNhaXuatBan"));
                nxb.setTenNhaXuatBan(rs.getNString("TenNhaXuatBan"));

                dsnxb.add(nxb);

            }
            helper.close();

         }
      catch(Exception ex){
          System.out.print(ex.getMessage());

      }
      return  dsnxb;

    }
}
